]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: Do not consider networks without ID as available
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 30 Jun 2025 18:31:13 +0000 (20:31 +0200)
committerMarge Bot <marge-bot@gnome.org>
Sat, 12 Jul 2025 19:11:52 +0000 (19:11 +0000)
In some rare (and weird) cases network manager may provide us
connections without settings (since connection.get_settings() is
actually nullable, and this may lead to have a NULL connection ID, that
eventually breaks the network menu completely:

  (gnome-shell:1579214): GNOME Shell-CRITICAL **: 20:27:14.874: Error:
    Argument str2 may not be null

  Stack trace:
    _sortByName@resource:///org/gnome/shell/ui/status/network.js:119:21
    lowerBound@resource:///org/gnome/shell/misc/util.js:253:13
    insertSorted@resource:///org/gnome/shell/misc/util.js:279:25
    _upsert@resource:///org/gnome/shell/ui/status/network.js:128:21
    upsert@resource:///org/gnome/shell/ui/status/network.js:147:21
    _addConnection@resource:///org/gnome/shell/ui/status/network.js:578:38
    _syncConnections@resource:///org/gnome/shell/ui/status/network.js:511:18
    NMDeviceItem@resource:///org/gnome/shell/ui/status/network.js:469:14
    NMWiredDeviceItem@resource:///org/gnome/shell/ui/status/network.js:611:1
    _createDeviceMenuItem@resource:///org/gnome/shell/ui/status/network.js:1909:16
    _ensureDeviceItem@resource:///org/gnome/shell/ui/status/network.js:1744:27
    _syncDeviceItem@resource:///org/gnome/shell/ui/status/network.js:1717:18
    _addDevice@resource:///org/gnome/shell/ui/status/network.js:1767:14
    _loadInitialItems@resource:///org/gnome/shell/ui/status/network.js:1680:18
    setClient@resource:///org/gnome/shell/ui/status/network.js:1420:18
    setClient@resource:///org/gnome/shell/ui/status/network.js:1651:15
    _getClient/<@resource:///org/gnome/shell/ui/status/network.js:2126:30
    _getClient@resource:///org/gnome/shell/ui/status/network.js:2125:33
    async*_init@resource:///org/gnome/shell/ui/status/network.js:2119:14
    SystemIndicator@resource:///org/gnome/shell/ui/quickSettings.js:847:1
    Indicator@resource:///org/gnome/shell/ui/status/network.js:2073:1
    _setupIndicators@resource:///org/gnome/shell/ui/panel.js:523:29
    async*QuickSettings@resource:///org/gnome/shell/ui/panel.js:514:14
    _ensureIndicator@resource:///org/gnome/shell/ui/panel.js:903:25
    _updateBox@resource:///org/gnome/shell/ui/panel.js:914:34
    _updatePanel@resource:///org/gnome/shell/ui/panel.js:868:14
    _init@resource:///org/gnome/shell/ui/panel.js:692:14
    Panel@resource:///org/gnome/shell/ui/panel.js:648:1
    _initializeUI@resource:///org/gnome/shell/ui/main.js:246:13
    start@resource:///org/gnome/shell/ui/main.js:180:11
    @resource:///org/gnome/shell/ui/init.js:12:47
    @resource:///org/gnome/shell/ui/init.js:21:20

Now, despite that specific connection here has valid settings when
loaded from dbus, it may still happen that NM lib fails at other level in
fetching its settings.

That said, we should not fail if a connection has no settings, and
just skip it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3785>

js/ui/status/network.js

index 4b5ff47253a270eb19a3125bde7adea80fbbbe25..4cabfda655e8fe1c44df29171433a4644801fd05 100644 (file)
@@ -500,7 +500,8 @@ const NMDeviceItem = GObject.registerClass({
     }
 
     _syncConnections() {
-        const available = this._device.get_available_connections();
+        const available = this._device.get_available_connections().filter(
+            c => c.get_id() != null);
         const removed = [...this._connectionItems.keys()]
             .filter(conn => !available.includes(conn));